<?php

defined('IN_PHPCMS') or exit('No permission resources.');
pc_base::load_app_class('admin', 'admin', 0);

class feedback extends admin {

    public function __construct() {
        parent::__construct();
    }

    public function init() {
        $db_feedback = pc_base::load_model('feedback_model');

        $where = '1';
        $status = isset($_GET['status']) ? (int)$_GET['status'] : -1;
        if (in_array($status, [0, 1, 2])) {
            $where .= " and `status`='$status'";
        }

        $uid = $_GET['uid'] ? (int)$_GET['uid'] : '';
        if ($uid) {
            $where .= " and uid=$uid";
        }

        $a_id = $_GET['a_id'] ? (int)$_GET['a_id'] : '';
        if ($a_id) {
            $where .= " and a_id=$a_id";
        }

        $datas = $db_feedback->listinfo($where, 'id desc', $_GET['page']);
        $pages = $db_feedback->pages;
        include $this->admin_tpl('feedback_list');
    }
}